package com.oig.sys.base.dao;

import com.oig.sys.base.entity.TbHsGoodsTariff;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
@author wuxl
*/
public interface ITbHsGoodsTariffDao extends JpaRepository<TbHsGoodsTariff, Integer> {

	@Query("from TbHsGoodsTariff t where t.id=:id")
	TbHsGoodsTariff getGoodsTariffById(@Param("id") Integer id);


	TbHsGoodsTariff getByCountryCodeAndHsCode(String countryCode, String hsCode);

	@Query("from TbHsGoodsTariff t where t.hsCode=:hsCode")
	List<TbHsGoodsTariff> findByHsCode(@Param("hsCode") String hsCode);

	@Query("from TbHsGoodsTariff t where t.hsCode=:hsCode and t.id not in(:idList)")
	List<TbHsGoodsTariff> findByHsCodeExIdList(@Param("hsCode") String hsCode, @Param("idList") List<Integer> idList);
}
